package com.remove.lsh;

import com.remove.lsh.utils.LSHUtil;
import com.remove.lsh.utils.TestString;

/**
 * @author tannc
 */
public class LSH {

    public static void main(String[] args) {
        int [] sumValues = new int[32];
        char[] strs = TestString.x1.toCharArray();
        byte [] bytes;
        for(int i = 0; i<strs.length;i++){
            bytes = LSHUtil.toBytes(String.valueOf(strs[i]).hashCode());
            // 计算
            for( int j =0;j<32;j++){
                sumValues[j] = sumValues[j] + (bytes[j]==1?1:-1);
            }
        }
        LSHUtil.printType(sumValues);
        bytes = new byte[32];
        for(int i=0,len = sumValues.length;i< len ;i++){
            bytes[i] = (byte) (sumValues[i] >=0 ? 1 : 0);
        }
        LSHUtil.printType(bytes);
    }


}
